def get_json_from_llm(res):
    res = res.strip()
    res = res.replace('\n\n', '\n').replace(' ', '')
    res = res.replace('"，', '",')
    res = res.replace('}{', '},{')

    start_tag, end_tag = '```json', '```'
    left = res.find(start_tag)
    if left == -1:
        start_tag = '```'
        left = res.find(start_tag)
    right = res.rfind(end_tag)
    if left != -1 and right != -1 and right > left:
        res = res[left+len(start_tag):right].strip()
    elif left != -1:
        res = res[left+len(start_tag):].strip()
    else:
        res = res.strip('`')

    if '``````json' in res:
        tmp = res.split('``````json')
        res = '[' + ','.join(tmp) + ']'
    
    res = res.replace('"""', '"')

    try:
        data = eval(res)
    except:
        print('Error: get_json_from_llm')
        print('res:', res)
        data = {}

    return data